Request.prototype = new Element();
Request.prototype.constructor = Element;
Request.prototype.request = function(cfg){
    var method = 'POST';
    if(cfg && cfg.method && (cfg.method == 'POST' || cfg.method == 'GET'))
        method = cfg.method;
    
    var _data = {};
    var _this = this;
    
    for(var i in cfg.data){
        
        
        if(cfg.data[i] instanceof Object || cfg.data[i] instanceof Array){
            _data[i] = _this.json_encode(cfg.data[i]);
        }
        else{
                _data[i] = cfg.data[i];
            }
    }
    
    
    jQuery.ajax({
        url: cfg.url,
//        data:cfg.data,
        data:_data,
        type:method,
        success: function(data) {
            if(data && data!==null){
                cfg.success(data);
            }
        },
        error:function(data){
            if(cfg.error){
                cfg.error(data);
            }
        },
        dataFilter:function(dataType){
            return dataType;
        }
    });
};
function Request(options){
    this.request(options);
}